﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ImobitechModel.com.Controller;

namespace Imobitech.Gestao
{
    public partial class Anuncios : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ControladorGestao cg = new ControladorGestao();
            int id = Request.QueryString["id"] != null ? int.Parse(Request.QueryString["id"].ToString()) : 0;
            gdvAnuncios.DataSource = cg.buscaAnuncios(id);
            gdvAnuncios.DataBind();
        }

        protected void gdvAnuncios_RowDataBound(object sender, GridViewRowEventArgs e)
        {

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Image img = (Image)e.Row.FindControl("imagePago");
                if (e.Row.Cells[4].Text == "True")
                {
                    img.ImageUrl = "../imagens/ok.jpg";
                    e.Row.Cells[4].Text = "Aprovado";
                }
                else
                {
                    img.ImageUrl = "../imagens/excluir.jpg";
                    e.Row.Cells[4].Text = "Falta aprovar";
                }
            }
        }
    }
}